package com.loyal.loyalerp.humenresource.role.mapper;

import java.util.List;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectProvider;

import com.loyal.loyalerp.basedata.company.model.GyCompany;
import com.loyal.loyalerp.humenresource.role.model.GyRole;
@Mapper
public interface GyRoleMapper {
	@Select("select * from gy_role")
	List<GyRole> alllistRole();
	
	@Select("select * from gy_company")
	List<GyCompany> companyList();
	
	@Select("select CompanyName from gy_company where id = #{id}")
	String companyListById(Integer id);
	
	@Select("SELECT Id FROM gy_company WHERE CompanyName= #{companyName}")
	Integer companyListByName(String companyName);
	
	@SelectProvider(type=GyRoleProvider.class,method="listRole")
	List<GyRole> listRole(String sord);
	
	@SelectProvider(type=GyRoleProvider.class,method="findCompanyId")
	Integer findCompanyId(String companyname);
	
	@SelectProvider(type=GyRoleProvider.class,method="findRole")
	List<GyRole> findRole(String searchField, String searchString,String searchOper);
	
	int selectRoleIDByRoleName(String rolename);
	
    int deleteByPrimaryKey(Integer id);

    int insert(GyRole record);

    int insertSelective(GyRole record);

    GyRole selectByPrimaryKey(Integer id);

    int updateByPrimaryKeySelective(GyRole record);

    int updateByPrimaryKey(GyRole record);
    @Delete("delete from gy_role where companyId=#{id}")
	int deleteByCompanyId(Integer id);
    @Select("select * from gy_role where companyId=#{id}")
	List<GyRole> selectByCompanyId(Integer id);
}